package ac.zlf.springmybatis.core.mybatis.dialect;

import ac.zlf.springmybatis.core.mybatis.domain.PageRequest;

import org.apache.ibatis.mapping.MappedStatement;

public class HSQLDialect extends Dialect {
    public HSQLDialect(MappedStatement mappedStatement, Object parameterObject, PageRequest pageRequest) {
        super(mappedStatement, parameterObject, pageRequest);
    }

    protected String getLimitString(String sql, String offsetName, int offset, String limitName, int limit) {
        boolean hasOffset = offset > 0;
        return new StringBuffer(sql.length() + 10).append(sql).insert(sql.toLowerCase().indexOf("select") + 6, " top " + String.valueOf(limit)).toString();
    }
}